from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt

from shareAPI2020TB import settings


@csrf_exempt
def gettxt(request, **kwargs):
    try:
        f = open(settings.BASE_DIR + request.path)
        t = f.read()
        f.close()
        return HttpResponse(t, content_type='text/plain')
    except Exception as e:
        return HttpResponse(e, content_type='text/plain')